package ink.feta.task.job.registry;

import org.apache.shardingsphere.elasticjob.lite.lifecycle.api.*;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.operate.JobOperateAPIImpl;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.operate.ShardingOperateAPIImpl;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.settings.JobConfigurationAPIImpl;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.statistics.JobStatisticsAPIImpl;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.statistics.ServerStatisticsAPIImpl;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.statistics.ShardingStatisticsAPIImpl;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class JobAPIProxy {

    @Resource
    CoordinatorRegistryCenter coordinatorRegistryCenter;

    public JobConfigurationAPI getJobConfigurationAPI() {
        return new JobConfigurationAPIImpl(coordinatorRegistryCenter);
    }

    public JobOperateAPI getJobOperateAPI() {
        return new JobOperateAPIImpl(coordinatorRegistryCenter);
    }

    public ShardingOperateAPI getShardingOperateAPI() {
        return new ShardingOperateAPIImpl(coordinatorRegistryCenter);
    }

    public JobStatisticsAPI getJobStatisticsAPI() {
        return new JobStatisticsAPIImpl(coordinatorRegistryCenter);
    }

    public ServerStatisticsAPI getServerStatisticsAPI() {
        return new ServerStatisticsAPIImpl(coordinatorRegistryCenter);
    }

    public ShardingStatisticsAPI getShardingStatisticsAPI() {
        return new ShardingStatisticsAPIImpl(coordinatorRegistryCenter);
    }

}
